package com.assisjrs.jpaandroid.persistence;

import java.util.Map;

import android.database.sqlite.SQLiteDatabase;

public class EntityManagerFactoryImpl implements EntityManagerFactory {
	private final SQLiteDatabase sqliteDatabase;

	public EntityManagerFactoryImpl(final SQLiteDatabase sqliteDatabase, final String persistenceUnit,
	        final Map properties) {
		this.sqliteDatabase = sqliteDatabase;
	}

	@Override
	public void close() {
		sqliteDatabase.close();
	}

	@Override
	public EntityManager createEntityManager() {
		return new EntityManagerImpl(sqliteDatabase);
	}

	@Override
	public boolean isOpen() {
		return sqliteDatabase.isOpen();
	}
}
